#if !UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;

namespace WL.Engine.Runtime
{

    [UnityEngine.Scripting.Preserve]//此特性用于防止在打包的时候这个脚本没有被打包进程序
    public class SkipUnityLogo
    {
    //此特性用于在启动画面显示之前执行这个方法
        [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
        private static void BeforeSplashScreen()
        {
#if UNITY_WEBGL
            Application.focusChanged += Application_focusChanged;
#else
        System.Threading.Tasks.Task.Run(AsyncSkip);
#endif
        }

#if UNITY_WEBGL
        private static void Application_focusChanged(bool obj)
        {
            Application.focusChanged -= Application_focusChanged;
            SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
        }
#else
    private static void AsyncSkip()
    {
        SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
    }
#endif
    } 
}
#endif